let str
while ((str = readline())) {
  let people = readline()
  let laji = readline()
  let piao = readline()

  let sum = 0
  let res = {}

  let pArr = people.split(' ')
  let piaoArr = piao.split(' ')

  for (let k of piaoArr) {
    if (pArr.includes(k)) {
      if (res[k]) {
        res[k]++
      } else {
        res[k] = 1
      }
    } else {
      sum++
    }
  }
  for (let k of pArr) {
    if (res[k]) {
      console.log(k + ' : ' + res[k])
    } else {
      console.log(k + ' : ' + 0)
    }
  }
  console.log('Invalid : ' + sum)
}
